<template>
  <div class="mo-userinfo">
    <Row class="mo-userinfo-row">
      <Col :lg="{span:16,offset:4}" class="userinfo-col">
        <div class="userinfo-top">
          <div class="userinfo-top-img">
            <img src="@/examples/assets/img/qinlian.jpg" />
            <span>别动我结菜</span>
            <div>lv.2</div>
          </div>
        </div>
        <div class="userinfo-bot">
          <div class="userinfo-bot-slt" @click="selectItem">
            <router-link to="userinfoJb">
              <div class="slt-item" id="slt-item1">基本资料</div>
            </router-link>
            <router-link to="userinfoSc">
              <div class="slt-item" id="slt-item2">我的收藏</div>
            </router-link>
            <router-link to="userinfoGz">
              <div class="slt-item" id="slt-item3">我的关注</div>
            </router-link>
            <router-link to="userinfoFs">
              <div class="slt-item" id="slt-item4">我的粉丝</div>
            </router-link>
          </div>
          <transition name="userinfo">
            <router-view></router-view>
          </transition>
        </div>
      </Col>
    </Row>
  </div>
</template>
<script>
import $ from "jquery";

export default {
  name: "moUserinfo",
  data() {
    return {};
  },
  mounted() {
    console.log(this.$router.history.current.name);
    switch (this.$router.history.current.name) {
      case "UserinfoJb":
        $("#slt-item1").addClass("slt-item-o");
        return;
      case "UserinfoSc":
        $("#slt-item2").addClass("slt-item-o");
        return;
      case "UserinfoGz":
        $("#slt-item3").addClass("slt-item-o");
        return;
    }
  },
  methods: {
    selectItem: function(e) {
      // alert(e.target.id)
      // alert('#'+e.target.id)
      const eid = e.target.id;
      if (!!eid) {
        $(".slt-item").removeClass("slt-item-o");
        $("#" + eid).addClass("slt-item-o");
      }
    }
  },
};
</script>
<style lang="scss" scoped>
a {
  color: black;
}
.mo-userinfo {
  position: relative;
  width: 100%;
  height: 100%;
  .mo-userinfo-row {
    position: relative;
    width: 100%;
    height: 100%;
    .userinfo-col {
      background-color: white;
      height: auto;
      .userinfo-top {
        display: flex;
        height: 160px;
        justify-content: center;
        .userinfo-top-img {
          display: flex;
          width: 20%;
          height: 100%;
          justify-content: center;
          align-items: center;
          flex-direction: column;
          img {
            width: 80px;
            height: 80px;
            border-radius: 50%;
            margin-bottom: 10px;
          }
          span {
            font-size: 14px;
            font-weight: 700;
          }
        }
      }
      .userinfo-bot {
        width: 100%;
        height: auto;
        padding-bottom: 20px;
        // min-height: 600px;
        height: 654px;
        .userinfo-bot-slt {
          display: flex;
          justify-content: flex-start;
          align-items: center;
          position: relative;
          width: 100%;
          height: 30px;
          padding-left: 5%;
          &::before {
            content: "";
            position: absolute;
            width: 90%;
            height: 1px;
            background-color: black;
            left: 5%;
            top: 0;
          }
          .slt-item {
            margin-right: 10px;
            width: 60px;
            height: 25px;
            font-size: 14px;
            line-height: 25px;
            cursor: pointer;
            // border-bottom: 1px solid black;
            box-sizing: border-box;
            &:hover {
              border-bottom: 1px solid black;
            }
          }
        }
      }
    }
  }
}
.slt-item-o {
  border-bottom: 1px solid black;
}
.userinfo-enter-active {
  // transition: all 0.4s;
}
.userinfo-enter {
  opacity: 0;
  //  transform: translate3d(0,20px,0);
}
</style>